//
//  DBManager.h
//  PostMessa
//
//  Created by never down on 15-5-12.
//  Copyright (c) 2015年 ygy_ios. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import <sqlite3.h>
#import "User.h"
//#import "Item.h"

#define DB_NAME         @"demo.sqlite"
#define DB_MODELNAME    @"myModel"

@interface DBManager : NSObject{
    sqlite3 *itemsDB;
    NSString * _databasePath;
    BOOL initContents;
    @private
        NSManagedObjectContext *_managedObjectContext;
        NSManagedObjectModel *_managedObjectModel;
        NSPersistentStoreCoordinator *_persistentStoreCoordinator;
//        NSString *itemID;
//        NSString *Category;
//        NSString *itemName;
//        NSString *itemImageUrl;
//        NSString *itemDescUrl;
//        NSString *itemPrice;
}
@property (nonatomic,retain,readonly) NSString *databasePath;
//@property (nonatomic,strong) NSString *category;
//@property (nonatomic) BOOL isAdminIstrator;
//@property (nonatomic, assign) BOOL isAdminstrator;
//@property (nonatomic,strong) DBManager *dbManager;

+ (DBManager *)shareDBManagerInstance;
//- (void)createTable;
- (void)createItemDB;
//- (void)createUserTable;
//- (void)createOrderTable;
//- (void)saveToDataBase:(Item *)item;
//- (void)saveToDataBase1:(NSArray *)itemArray;
//- (NSMutableArray *)getItemDataWithCategory:(NSString *)string;
//- (NSMutableArray *)getItemDataWithItemID:(NSString *)string;
//- (BOOL)userSigninSuccess:(NSString *)name password:(NSString *)password;
//- (BOOL)userSignupSuccess:(NSString *)name password:(NSString *)password;
//- (NSMutableDictionary *)getAllItemList;
//- (NSMutableArray *)getOrderIdWithUserName:(NSString *)userName;
-(NSMutableDictionary *)getAllUserList;
-(void)insertUser;
-(NSArray *)fetchUser;
-(BOOL)initDBContents:(NSManagedObjectContext *)context;
-(id)initWithDbPath:(NSString *)DBPath;
-(NSManagedObjectContext *)manageObjectContext;
@end